#!/usr/bin/env python3
# encoding=utf-8
# @brief    Target Definitions File
#*********************************************************************************
# Copyright (c) 2024, Qi Yaolong.
# dragon@hbu.edu.cn
# HeBei University, China.
#
# 简体中文
# 保留所有权利。依据GPL 2.0（以下简称"本许可"）进行许可。除非符合（遵守）本许可及以下条款，否则
# 您不得使用此文件：
#  
# 禁止任何未经授权的个人或组织以任何形式将本程序及其附属资料、创新、创意、架构设计、算法、衍生作品
# 等用于任何商业目的、盈利活动、各类竞赛(比赛)、直播教学、录播教学、线下课程、书籍编写、教材编写、
# 会议、培训、公益活动、项目课题、毕业设计、毕业论文、学术论文等。
#  
# 本程序由版权持有人和贡献人“按原样”提供，不提供任何明示或暗示担保，包括但不局限于对适销性和特定
# 用途适合性的暗示担保。在任何情况下，版权持有人或贡献人对因使用本程序而导致的任何直接、间接、附带、
# 特殊、典型或后果性损害（包括但不限于购买替代商品或服务；使用损失、数据丢失或利润损失；业务中断）
# 不承担任何责任，无论其如何产生，也不论其责任理论为何，无论是合同、严格责任还是侵权（包括疏忽或
# 其他），即使已告知此类损害的可能性。
# 
# English
# All rights reserved. Licensed under the GPL 2.0 (the "License"). You may NOT 
# use this file except in compliance with the License and the following terms:
#
# IT IS PROHIBITED FOR ANY UNAUTHORIZED PERSON OR ENTITY TO USE THIS PROGRAM AND 
# ITS ANCILLARY DATA, INNOVATIONS, CONCEPTS, ARCHITECTURE DESIGN, ALGORITHMS, 
# DERIVED WORKS, ETC., IN ANY FORM FOR COMMERCIAL PURPOSES, PROFIT-MAKING 
# ACTIVITIES, VARIOUS COMPETITIONS (CONTESTS), LIVE TEACHING, PRE-RECORDED 
# LESSONS, OFFLINE COURSES, BOOK WRITING, CONFERENCES, TRAININGS, PUBLIC WELFARE 
# ACTIVITIES, PROJECTS, TOPICS, GRADUATION DESIGNS, DISSERTATIONS, THESES, AND 
# OTHER APPLICATIONS.
#
# THIS PROGRAM IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS PROGRAM, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#*********************************************************************************
target = {
    'ws63-liteos-app': {
        'base_target_name': 'target_ws63_app_rom_template',
        'os': 'liteos',
        'defines': [
            "USE_CMSIS_OS",
            "USE_LITEOS",
            "_ALL_SOURCE",
            "__LITEOS__",
            "-:CHIP_WS63=1",
            "LIBUTIL_COMPAT",
            "LOG_SUPPORT",
            "HSO_SUPPORT",
            "NO_TCXO_SUPPORT",
            "UNSUPPORT_OTHER_MEM",
            "SW_UART_DEBUG",
            "SW_UART_CHIP_DEFINE",
            "AT_COMMAND",
            "DUMP_MEM_SUPPORT",
            "BUILD_APPLICATION_STANDARD",
            'CMD_ENABLE',
            'WIFI_TASK_EXIST',
            'BGLE_TASK_EXIST',
            'BTH_TASK_EXIST',
            "CONFIG_IPERF_SUPPORT",
            "CONFIG_SENDTEST_SUPPORT",
            "_PRE_WLAN_FEATURE_BTCOEX",
            "_PRE_LWIP_ZERO_COPY",
            #"WIFI_TCM_OPTIMIZE",
            #"LWIP_TCM_OPTIMIZE",
            "CHECKSUM_CHECK_TCP=0",
            "CHECKSUM_CHECK_UDP=0",
            "MBEDTLS_AES_ROM_TABLES",
            "UPDATE_WIFI_STATIC_LIB",
            "UPDATE_BTC_STATIC_LIB",
            "CONFIG_NV_SUPPORT_SINGLE_CORE_SYSTEM", 'CONFIG_OTA_UPDATE_SUPPORT',
            "MBEDTLS_HARDEN_OPEN",
            'CONFIG_UART_SUPPORT_LPM',
            "_PRE_RADAR_CCA_SW_OPT",
            "MBEDTLS_CONFIG_FILE=\"config-ws-iot.h\""
        ],
        'ram_component': [
            'ws63_liteos_app',
            'ws63_liteos_app_lds',
            'liteos_port',
            'irmalloc',
            'non_os',
            '-:rtc',
            'arch_port',
            'board_config', # 被 pinctrl 组件依赖
            'lpm', # 被 pwm 组件依赖
            'chip_ws63', 'pmp_cfg_ws63',
            'reboot', 'hal_reboot', 'reboot_port', 'cpu_utils', 'hal_cpu_core',
            'testsuite',
            'gpio','hal_gpio_v150','gpio_port',
            "dfx_port_ws63", "algorithm", "cmn_header", "lwip", "lwip_tcm", "wifi_service", "mbedtls", "wpa_supplicant", 'enterprise_cert',
            "at", "wifi_driver_hmac", "wifi_driver_dmac", "wifi_driver_tcm", "wifi_at", "wifi_csa", "wifi_frag", "wifi_alg_txbf", "wifi_alg_temp_protect", "wifi_tx_amsdu",
            "wifi_auto_adjust_freq", "wifi_alg_anti_interference", "wifi_alg_edca_opt", "wifi_alg_cca_opt", "wifi_radar_sensor",
            'wifi_btcoex', "wifi_uapsd_ap",
            'liteos_208_5_0', 'rtc_unified', 'hal_rtc_unified', 'rtc_unified_port',
            'nv', 'nv_ws63', 'nv_zdiag_ws63', 'plt_at', 'dfx_printer',
            'update_common', 'update_common_ws63', 'update_ab_ws63', 'factory_ws63', 'update_storage',
            'pm_port_ws63',
            'gmssl_hmac_sm3',
            'bt_at',
            "bt_host",
            'bg_common',
            'libboundscheck_sscanf_s',
            'bth_gle',
            'bth_sdk',
            'samples',
            'bts_header',
            'bt_app',
            'mips',
            'hal_mips',
            "bgtp",
            'soc_port',
            'radar_sensing',
            'radar_at',
            'ohos_adapt',
            "wifiservice","hal_iothardware",
            'little_fs','littlefs_adapt_ws63',
            "begetutil"   ,"hilog_lite_static", "samgr_adapter", "bootstrap", "fsmanager_static" ,"hal_update_static", "hilog_static", "inithook",   "samgr_source",
            "broadcast", "hal_file_static"  ,"init_log" , "native_file", "udidcomm",
            "cjson_static", "hal_sys_param", "hichainsdk" ,"hota" ,"init_utils" , "param_client_lite",
            "hal_sysparam" ,"hievent_lite_static" ,"huks_3.0_sdk"  , "samgr",
            "hidumper_mini","hiview_lite_static","blackbox_lite",
            'xo_trim_port',
            # "mqtt",
            #"servo",
            #"led_demo",
            #"adc_demo",
            #"Motor",
            #"sle_light_control",
            #"sle_client",
            "sle_server",
        ],
        'ccflags': [
            "-DBOARD_ASIC", '-DPRE_ASIC',
        ],
        'application': 'application',
        'bin_name': 'ws63-liteos-app',
        'smaller': True,
        'hso_enable_bt': True,
        'hso_enable': True,
        'codesize_statistic': True,
        'nv_update':True,
        'generate_efuse_bin': True,
        'copy_files_to_interim': True
    },
    'ws63-flashboot': {
        'base_target_name': 'target_ws63_boot_template',
        'CONFIG_TIMER_USING_V150': 'y',
        "CONFIG_PMP_USING_RISCV_31" : 'y',
        'defines': [
            "__NON_OS__",
            "WS63_PRODUCT_NONE",
            "CONFIG_TIMER_MAX_NUM=3",
            "CONFIG_TIMER_CLOCK_VALUE=24000000",
            "CONFIG_TIMER_0_WIDTH_64=0",
            "SW_UART_DEBUG",
            "CONFIG_UART_SUPPORT_RX",
            "CONFIG_UART_SUPPORT_TX",
            "BUILD_APPLICATION_ROM",
            "BUILD_NOOSAL",
            "EFUSE_BIT_OPERATION",
        ],
        'ram_component': [
            "flashboot_common", "common_boot", "ws63_flashboot_lds", "dfx_preserve",
            "libboundscheck", "chip_ws63", "ws63_mem_config", "common_headers","non_os", "sfc_port_ws63", 'sfc_flash_config_ws63',
            "cmn_header", "arch_port", "osal", "dfx_panic", "dfx_exception","cpu_utils",
            '-:rtc', '-:hal_rtc', "common_boot_libc",
            "error_code", "board_config", "chip_boot_port", "chip_boot_config",
             '-:hal_systick', 'partition', 'partition_ws63','pmp_cfg_ws63', 'nonos_malloc', 'nonos_malloc_port',
            'update_common', 'update_local', 'update_local_ws63', 'lzma_21.07', 'update_common_ws63', 'update_ab_ws63', 'factory_ws63',
            'efuse', 'hal_efuse_v151', 'efuse_port', 'soc_port',
        ],
        'ram_component_set': ['uart', "time_set", "cpu", "pinctrl", "sfc_flash", "watchdog", "security_unified",'pmp_set'],
        'os': 'non-os',
        'application': 'flashboot',
        'bin_name': 'flashboot'
    },
    'ws63-liteos-xts': {
        'base_target_name': 'target_ws63_xts_rom_template',
        'liteos_kconfig': 'ws63_xts',
        'os': 'liteos',
        'defines': [
            "USE_CMSIS_OS",
            "USE_LITEOS",
            "_ALL_SOURCE",
            "__LITEOS__",
            "-:CHIP_WS63=1",
            "LIBUTIL_COMPAT",
            "LOG_SUPPORT",
            "HSO_SUPPORT",
            "CONFIG_SUPPORT_NEW_DIAG",
            "NO_TCXO_SUPPORT",
            "UNSUPPORT_OTHER_MEM",
            "SW_UART_DEBUG",
            "SW_UART_CHIP_DEFINE",
            "AT_COMMAND",
            "DUMP_MEM_SUPPORT",
            "BUILD_APPLICATION_STANDARD",
            'CMD_ENABLE',
            'WIFI_TASK_EXIST',
            'BGLE_TASK_EXIST',
            'BTH_TASK_EXIST',
            "CONFIG_IPERF_SUPPORT",
            "CONFIG_SENDTEST_SUPPORT",
            "CONFIG_CACHE_MISS_SUPPORT",
            "_PRE_WLAN_FEATURE_BTCOEX",
            "_PRE_LWIP_ZERO_COPY",
            #"WIFI_TCM_OPTIMIZE",
            #"LWIP_TCM_OPTIMIZE",
            "CHECKSUM_CHECK_TCP=0",
            "CHECKSUM_CHECK_UDP=0",
            "MBEDTLS_AES_ROM_TABLES",
            "UPDATE_WIFI_STATIC_LIB",
            "UPDATE_BTC_STATIC_LIB",
            "CONFIG_NV_SUPPORT_SINGLE_CORE_SYSTEM", 'CONFIG_OTA_UPDATE_SUPPORT',
            "MBEDTLS_HARDEN_OPEN",
            'CONFIG_UART_SUPPORT_LPM',
            "_PRE_RADAR_CCA_SW_OPT",
        ],
        'ram_component': [
            'ws63_liteos_app',
            'ws63_liteos_xts_lds',
            'liteos_port',
            'irmalloc',
            'non_os',
            '-:rtc',
            'arch_port',
            'board_config', # 被 pinctrl 组件依赖
            'lpm', # 被 pwm 组件依赖
            'chip_ws63', 'pmp_cfg_ws63',
            'reboot', 'hal_reboot', 'reboot_port', 'cpu_utils', 'hal_cpu_core',
            'testsuite',
            'gpio','hal_gpio_v150','gpio_port',
            "dfx_port_ws63", "algorithm", "cmn_header", "lwip", "lwip_tcm", "wifi_service", "mbedtls", "wpa_supplicant",
            "at", "wifi_driver_hmac", "wifi_driver_dmac", "wifi_driver_tcm", "wifi_at", "wifi_csa", "wifi_alg_txbf", "wifi_alg_temp_protect", "wifi_tx_amsdu", "wifi_sdp",
            "wifi_auto_adjust_freq", "wifi_promisc", "wifi_alg_anti_interference", "wifi_alg_edca_opt", "wifi_alg_cca_opt", "wifi_sr",
            "wifi_frag", "wifi_mbo", "wifi_bsrp_nfrp", "wifi_slp", "wifi_radar_sensor", "wifi_apf", "wifi_repeater", "wifi_csi", "wifi_wapi", "wifi_wps", "wifi_psd", "wifi_blacklist", "wifi_m2u",
            "wifi_latency", "wifi_roam", "wifi_uapsd_sta", "wifi_ant_sel", "wifi_twt", "wifi_11k", "wifi_11v", "wifi_11r",  'wifi_btcoex', "wifi_uapsd_ap", "wifi_dnb",
            'liteos_208_5_0', 'rtc_unified', 'hal_rtc_unified', 'rtc_unified_port',
            'nv', 'nv_ws63', 'nv_zdiag_ws63', 'plt_at',
            'update_common', 'update_common_ws63', 'update_ab_ws63', 'factory_ws63', 'update_storage',
            'pm_port_ws63',
            'gmssl_hmac_sm3',
            'bt_at',
            "bt_host",
            'bg_common',
            'bth_gle',
            'bth_sdk',
            'samples',
            'bts_header',
            'bt_app',
            'mips',
            'hal_mips',
            "bgtp",
            'soc_port',
            'radar_sensing',
            'radar_at',
            'ohos_adapt',
            'little_fs', 'littlefs_adapt_ws63',
            "begetutil", "devattest_sdk", "hal_token_static" ,    "hilog_lite_static" ,  "huks_test_common",  "module_ActsBootstrapTest"    ,    "module_ActsSamgrTest"  ,      "samgr_adapter",
            "bootstrap", "fsmanager_static"  ,"hal_update_static"  ,  "hilog_static"  ,      "inithook"   ,       "module_ActsDeviceAttestTest"   ,  "module_ActsUpdaterFuncTest"  ,"samgr_source",
            "broadcast","hal_file_static" ,  "hctest"    ,           "hiview_lite_static",  "init_log"   ,       "module_ActsDfxFuncTest"    ,      "native_file"      ,           "udidcomm",
            "cjson_static"  ,  "hal_sys_param"   ,  "hichainsdk"     ,      "hota"      ,          "init_utils" ,       "module_ActsHieventLiteTest"   ,   "param_client_lite",
            "devattest_core" , "hal_sysparam"  ,    "hievent_lite_static" , "huks_3.0_sdk"   ,       "module_ActsHuksHalFunctionTest" , "samgr",
            "blackbox_lite",
            "hidumper_mini",
            'xo_trim_port',
        ],
        'ccflags': [
            "-DBOARD_ASIC", '-DPRE_ASIC',
        ],
        'application': 'application',
        'bin_name': 'ws63-liteos-xts',
        'hso_enable_bt': True,
        'hso_enable': True,
        'codesize_statistic': True,
        'nv_update':True,
        'copy_files_to_interim': True
    },
    'ws63-liteos-app-iot': {
        'base_target_name': 'target_ws63_app_rom_template',
        'liteos_kconfig': 'ws63_iot',
        'os': 'liteos',
        'defines': [
            "USE_CMSIS_OS",
            "USE_LITEOS",
            "_ALL_SOURCE",
            "__LITEOS__",
            "-:CHIP_WS63=1",
            "LIBUTIL_COMPAT",
            "LOG_SUPPORT",
            "HSO_SUPPORT",
            "NO_TCXO_SUPPORT",
            "UNSUPPORT_OTHER_MEM",
            "SW_UART_DEBUG",
            "SW_UART_CHIP_DEFINE",
            "AT_COMMAND",
            "DUMP_MEM_SUPPORT",
            "BUILD_APPLICATION_STANDARD",
            'CMD_ENABLE',
            'WIFI_TASK_EXIST',
            'BGLE_TASK_EXIST',
            'BTH_TASK_EXIST',
            "CONFIG_IPERF_SUPPORT",
            "CONFIG_SENDTEST_SUPPORT",
            "_PRE_WLAN_FEATURE_BTCOEX",
            "_PRE_LWIP_ZERO_COPY",
            #"WIFI_TCM_OPTIMIZE",
            #"LWIP_TCM_OPTIMIZE",
            "CHECKSUM_CHECK_TCP=0",
            "CHECKSUM_CHECK_UDP=0",
            "MBEDTLS_AES_ROM_TABLES",
            "UPDATE_WIFI_STATIC_LIB",
            "UPDATE_BTC_STATIC_LIB",
            "CONFIG_NV_SUPPORT_SINGLE_CORE_SYSTEM", 'CONFIG_OTA_UPDATE_SUPPORT',
            "MBEDTLS_HARDEN_OPEN",
            'CONFIG_UART_SUPPORT_LPM',
            "MBEDTLS_CONFIG_FILE=\"config-ws-iot.h\"",
            "CONFIG_SUPPORT_HILINK",
            "_PRE_RADAR_CCA_SW_OPT",
            #"CONFIG_SUPPORT_HILINK_INDIE_UPGRADE",
            "CONFIG_DHCPS_GW",
        ],
        'ram_component': [
            'ws63_liteos_app',
            'ws63_liteos_app_lds',
            'liteos_port',
            'irmalloc',
            'non_os',
            '-:rtc',
            'arch_port',
            'board_config', # 被 pinctrl 组件依赖
            'lpm', # 被 pwm 组件依赖
            'chip_ws63', 'pmp_cfg_ws63',
            'reboot', 'hal_reboot', 'reboot_port', 'cpu_utils', 'hal_cpu_core',
            'testsuite',
            'gpio','hal_gpio_v150','gpio_port',
            "dfx_port_ws63", "algorithm", "cmn_header", "lwip", "lwip_tcm", "wifi_service", "mbedtls", "wpa_supplicant",
            "at", "wifi_driver_hmac", "wifi_driver_dmac", "wifi_driver_tcm", "wifi_at", "wifi_csa", "wifi_frag", "wifi_alg_txbf", "wifi_alg_temp_protect", "wifi_tx_amsdu",
            "wifi_auto_adjust_freq", "wifi_alg_anti_interference", "wifi_alg_edca_opt", "wifi_alg_cca_opt", "wifi_radar_sensor",
            'wifi_btcoex', "wifi_uapsd_ap",
            'liteos_208_5_0', 'rtc_unified', 'hal_rtc_unified', 'rtc_unified_port',
            'nv', 'nv_ws63', 'nv_zdiag_ws63', 'plt_at', 'dfx_printer',
            'update_common', 'update_common_ws63', 'update_ab_ws63', 'factory_ws63', 'update_storage',
            'pm_port_ws63',
            'gmssl_hmac_sm3',
            'bt_at',
            "bt_host",
            'bg_common',
            'bth_gle',
            'bth_sdk',
            'samples',
            'bts_header',
            'bt_app',
            'mips',
            'hal_mips',
            "bgtp",
            'soc_port',
            'radar_sensing',
            'radar_at',
            'cjson',
            'xo_trim_port',
            'hilink',
            #'app_addr_map',
            'hilinkdevicesdk',
            'hilinkota',
            'hilinkbtsdk',
            'huks_sdk',
            'deviceauth',
            'little_fs', 'littlefs_adapt_ws63',
        ],
        'ccflags': [
            "-DBOARD_ASIC", '-DPRE_ASIC',
        ],
        'application': 'application',
        'bin_name': 'ws63-liteos-app-iot',
        'smaller': True,
        'hso_enable_bt': True,
        'hso_enable': True,
        'codesize_statistic': True,
        'nv_update':True,
        'copy_files_to_interim': True
    },
    'ws63-liteos-hilink': {
        'base_target_name': 'target_ws63_hilink_rom_template',
        'os': 'liteos',
        'defines': [
            'CONFIG_SUPPORT_HILINK_INDIE_UPGRADE',
        ],
        'ram_component': [
            'ws63_liteos_hilink_lds',
            'cjson',
            'hilink_addr_map',
            'hilinkdevicesdk',
            'hilinkota',
            'hilinkbtsdk',
        ],
        'ccflags': [
            "-DBOARD_ASIC", '-DPRE_ASIC',
        ],
        'application': 'application',
        'bin_name': 'ws63-liteos-hilink',
        'copy_files_to_interim': True
    },
}

# custom copy rules, put it in target_group below and it takes effect.
# <root> means root path
# <out_root> means output_root path
# <pack_target> means target_group key_name
target_copy = {

}

target_group = {

}